<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <title>Title</title>
    <style>
      /*.container {*/
      /*  height: 100vh;*/
      /*  overflow: auto;*/
      /*}*/
      .box-red {
        width: 100%;
        height: 50vh;
      }

      .box-blue {
        width: 100%;
        height: 30vh;
      }

      .box-yellow {
        width: 100%;
        height: 60vh;
      }

      .box-pink {
        width: 100%;
        height: 60vh;
      }
    </style>
  </head>
  <body style="height: 100vh; overflow-y: auto">
    <div class="container">
      <h1>子页面</h1>
      <button onclick="onSendMsg2()">发送消息1002</button>
      <button onclick="onSendMsg1()">发送消息1001</button>
    </div>
    <script src="./lib/index.umd.js"></script>
    <script></script>

    <script>
      const { bus } = window.sfutils
			const onSendMsg1 = () => {
				console.log('子发送了：', 'hello【1001】', { id: 111 })
				bus.emit('1001', 'hello【1001】', { id: 111 })
			}

			const onSendMsg2 = () => {
				console.log('子发送了：', 'hello【1002】', { id: 222 })
				bus.emit('1002', 'hello【1002】', { id: 222 })
			}

			bus.on('1001', (...args) => {
				console.log('子监听到【1001】：', ...args)
			})

			bus.on('1002', (...args) => {
				console.log('子监听到【1002】：', ...args)
			})

			bus.on('xxx', (...args) => {
				console.log('子监听到【xxx】：', ...args)
			})
    </script>

    <script></script>
  </body>
</html>
